//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CIXml {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CIXml(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CIXml obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CIXml(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CIXml() {
    this(nelmiscJNI.new_CIXml__SWIG_0(), true);
  }

  public CIXml(boolean tryBinaryMode) {
    this(nelmiscJNI.new_CIXml__SWIG_1(tryBinaryMode), true);
  }

  public boolean init(IStream stream) {
    return nelmiscJNI.CIXml_init(swigCPtr, this, IStream.getCPtr(stream), stream);
  }

  public void release() {
    nelmiscJNI.CIXml_release(swigCPtr, this);
  }

  public SWIGTYPE_p_xmlNodePtr getRootNode() {
    return new SWIGTYPE_p_xmlNodePtr(nelmiscJNI.CIXml_getRootNode(swigCPtr, this), true);
  }

  public static SWIGTYPE_p_xmlNodePtr getFirstChildNode(SWIGTYPE_p_xmlNodePtr parent, String childName) {
    return new SWIGTYPE_p_xmlNodePtr(nelmiscJNI.CIXml_getFirstChildNode__SWIG_0(SWIGTYPE_p_xmlNodePtr.getCPtr(parent), childName), true);
  }

  public static SWIGTYPE_p_xmlNodePtr getNextChildNode(SWIGTYPE_p_xmlNodePtr last, String childName) {
    return new SWIGTYPE_p_xmlNodePtr(nelmiscJNI.CIXml_getNextChildNode__SWIG_0(SWIGTYPE_p_xmlNodePtr.getCPtr(last), childName), true);
  }

  public static SWIGTYPE_p_xmlNodePtr getFirstChildNode(SWIGTYPE_p_xmlNodePtr parent, SWIGTYPE_p_xmlElementType type) {
    return new SWIGTYPE_p_xmlNodePtr(nelmiscJNI.CIXml_getFirstChildNode__SWIG_1(SWIGTYPE_p_xmlNodePtr.getCPtr(parent), SWIGTYPE_p_xmlElementType.getCPtr(type)), true);
  }

  public static SWIGTYPE_p_xmlNodePtr getNextChildNode(SWIGTYPE_p_xmlNodePtr last, SWIGTYPE_p_xmlElementType type) {
    return new SWIGTYPE_p_xmlNodePtr(nelmiscJNI.CIXml_getNextChildNode__SWIG_1(SWIGTYPE_p_xmlNodePtr.getCPtr(last), SWIGTYPE_p_xmlElementType.getCPtr(type)), true);
  }

  public static long countChildren(SWIGTYPE_p_xmlNodePtr node, String childName) {
    return nelmiscJNI.CIXml_countChildren__SWIG_0(SWIGTYPE_p_xmlNodePtr.getCPtr(node), childName);
  }

  public static long countChildren(SWIGTYPE_p_xmlNodePtr node, SWIGTYPE_p_xmlElementType type) {
    return nelmiscJNI.CIXml_countChildren__SWIG_1(SWIGTYPE_p_xmlNodePtr.getCPtr(node), SWIGTYPE_p_xmlElementType.getCPtr(type));
  }

  public static boolean getPropertyString(SWIGTYPE_p_std__string result, SWIGTYPE_p_xmlNodePtr node, String property) {
    return nelmiscJNI.CIXml_getPropertyString(SWIGTYPE_p_std__string.getCPtr(result), SWIGTYPE_p_xmlNodePtr.getCPtr(node), property);
  }

  public static int getIntProperty(SWIGTYPE_p_xmlNodePtr node, String property, int defaultValue) {
    return nelmiscJNI.CIXml_getIntProperty(SWIGTYPE_p_xmlNodePtr.getCPtr(node), property, defaultValue);
  }

  public static double getFloatProperty(SWIGTYPE_p_xmlNodePtr node, String property, float defaultValue) {
    return nelmiscJNI.CIXml_getFloatProperty(SWIGTYPE_p_xmlNodePtr.getCPtr(node), property, defaultValue);
  }

  public static String getStringProperty(SWIGTYPE_p_xmlNodePtr node, String property, String defaultValue) {
    return nelmiscJNI.CIXml_getStringProperty(SWIGTYPE_p_xmlNodePtr.getCPtr(node), property, defaultValue);
  }

  public static boolean getContentString(SWIGTYPE_p_std__string result, SWIGTYPE_p_xmlNodePtr node) {
    return nelmiscJNI.CIXml_getContentString(SWIGTYPE_p_std__string.getCPtr(result), SWIGTYPE_p_xmlNodePtr.getCPtr(node));
  }

}
